package com.ch.ebusiness.controller.before;

import com.ch.ebusiness.service.before.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
public class IndexController {
    
    @Autowired
    private IndexService indexService;
    
    @Resource
    private BCryptPasswordEncoder bCryptPasswordEncoder;
    
    @RequestMapping("/")
    public String index(Model model, Integer tid) {
        return indexService.index(model, tid);
    }
    
    @RequestMapping("/goodsDetail")
    public String goodsDetail(Model model, Integer id) {
        return indexService.goodsDetail(model, id);
    }
    
    @RequestMapping("/search")
    public String search(Model model, String mykey) {
        return indexService.search(model, mykey);
    }
}
